package com.cc.self.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cc.self.dao.SelfJhDao;
import com.cc.self.model.raw.SelfJh;


@Service(value = "com.cc.self.service.SelfJhService")
public class SelfJhService {
	@Autowired
	private SelfJhDao aSelfJhDao;

	/**
	 * 根据组织查询列表
	 * @param bus_id 自营主键
	 * @return List<SelfJh>
	 */
	public List<SelfJh> getSelfJhList(int bus_id) {
		Map<String, Object> p = new HashMap<String, Object>();
		p.put("bus_id", bus_id);
		List<SelfJh> list = aSelfJhDao.getSelfJhList(p);
		return list;
	}

	/**
	 * 获取实体
	 * @param id 主键
	 * @return SelfJh
	 */
	public SelfJh getSelfJh(int id) {
		Map<String, Object> p = new HashMap<String, Object>();
		p.put("id", id);
		List<SelfJh> l = aSelfJhDao.getSelfJhList(p);
		return l.size() > 0 ? l.get(0) : null;
	}

	/**
	 * 创建实体
	 * @param SelfJh 实体信息
	 * @return SelfJh 实体信息
	 */
	public SelfJh createSelfJh(SelfJh entity) {
		aSelfJhDao.createSelfJh(entity);
		return entity;
	}
	
	/**
	 * 修改实体
	 * @param SelfJh 实体信息
	 * @return SelfJh 实体信息
	 */
	public SelfJh updateSelfJh(SelfJh entity) {
		aSelfJhDao.updateSelfJh(entity);
		return entity;
	}
	
	/**
	 * 删除实体
	 * @param SelfJh 实体信息
	 * @return SelfJh 实体信息
	 */
	public SelfJh deleteSelfJh(SelfJh entity) {
		deleteSelfJh(entity.getId());
		return entity;
	}
	
	/**
	 * 删除实体
	 * @param id 主键
	 * @return id 主键
	 */
	public int deleteSelfJh(int id) {
		aSelfJhDao.deleteSelfJh(id);
		return id;
	}

}

